{namespace be=TYPO3\CMS\Backend\ViewHelpers}

<input type="hidden" name="tx_scheduler[uid]" value="{uid}" />
<input type="hidden" name="previousCMD" value="{cmd}" />

<div class="form-section" id="task_disable_row">
    <div class="form-group">
        <f:be.labels.csh table="{csh}" field="task_disable" label="{task_disable_label}"/>
        <div class="form-control-wrap">
            <input type="hidden" name="tx_scheduler[disable]" value="0">
            <input class="checkbox" type="checkbox" name="tx_scheduler[disable]" value="1" id="task_disable" {task_disable}>
        </div>
    </div>
</div>
<div class="form-section" id="task_class_row">
    <div class="form-group">
        <f:be.labels.csh table="{csh}" field="task_class" label="{lang}label.class"/>
        <div class="form-control-wrap">
            <f:if condition="{task_class}">
                <f:then>
                    <div>{task_class_title} ({task_class_extension})</div>
                    <input type="hidden" name="tx_scheduler[class]" id="task_class" value="{task_class}">
                </f:then>
                <f:else>
                    <select name="tx_scheduler[class]" id="task_class" class="form-control">
                        <f:for each="{groupedClasses}" as="classGroup" key="extension">
                            <optgroup label="{extension}">
                                <f:for each="{classGroup}" as="classInfo" key="class">
                                    <option value="{class}" title="{classInfo.description}" {classInfo.selected}>{classInfo.title}</option>
                                </f:for>
                            </optgroup>
                        </f:for>
                    </select>
                </f:else>
            </f:if>
        </div>
    </div>
</div>
<div class="form-section" id="task_type_row">
    <div class="form-group">
        <f:be.labels.csh table="{csh}" field="task_type" label="{lang}label.type"/>
        <div class="form-control-wrap">
            <select name="tx_scheduler[type]" id="task_type" class="form-control">
                <option value="1" {task_type_selected_1}><f:translate key="{lang}label.type.single" /></option>
                <option value="2" {task_type_selected_2}><f:translate key="{lang}label.type.recurring" /></option>
            </select>
        </div>
    </div>
</div>
<div class="form-section" id="task_group_row">
    <div class="form-group">
        <f:be.labels.csh table="{csh}" field="task_group" label="{lang}label.group"/>
        <div class="form-control-wrap">
            <div class="input-group">
                <select name="tx_scheduler[task_group]" id="task_class" class="form-control">
                    <option value="0" title=""></option>
                    <f:for each="{registeredTaskGroups}" as="registeredTaskGroup">
                        <option value="{registeredTaskGroup.uid}" title="{registeredTaskGroup.groupName}" {registeredTaskGroup.selected}>
                        {registeredTaskGroup.groupName}
                        </option>
                    </f:for>
                </select>
                <div class="input-group-btn" role="group">
                    <be:link.newRecord class="btn btn-default" table="tx_scheduler_task_group" returnUrl="{returnUrl}">
                        <core:icon identifier="actions-add" />
                    </be:link.newRecord>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="form-section">
    <div class="row">
        <div class="form-group col-sm-6" id="task_start_col">
            <f:be.labels.csh table="{csh}" field="task_start" label="{lang}label.start"/>
            <div class="form-control-wrap">
                <div class="input-group" id="tceforms-datetimefield-task_start_row-wrapper">
                    <input name="tx_scheduler[start]_hr" value="{start_value_hr}" class="form-control t3js-datetimepicker t3js-clearable" data-date-type="datetime" data-date-offset="0" type="text" id="tceforms-datetimefield-task_start_row">
                    <input name="tx_scheduler[start]" value="{start_value}" type="hidden">
                    <span class="input-group-btn"><label class="btn btn-default" for="tceforms-datetimefield-task_start_row"><core:icon identifier="actions-edit-pick-date" /></label></span>
                </div>
            </div>
        </div>
        <div class="form-group col-sm-6" id="task_end_col">
            <f:be.labels.csh table="{csh}" field="task_end" label="{lang}label.end"/>
            <div class="form-control-wrap">
                <div class="input-group" id="tceforms-datetimefield-task_end_row-wrapper">
                    <input name="tx_scheduler[end]_hr" value="{end_value_hr}" class="form-control  t3js-datetimepicker t3js-clearable" data-date-type="datetime" data-date-offset="0" type="text" id="tceforms-datetimefield-task_end_row">
                    <input name="tx_scheduler[end]" value="{end_value}" type="hidden">
                    <span class="input-group-btn"><label class="btn btn-default" for="tceforms-datetimefield-task_end_row"><core:icon identifier="actions-edit-pick-date" /></label></span>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="form-section" id="task_frequency_row">
    <div class="form-group">
        <f:be.labels.csh table="{csh}" field="task_frequency" label="{lang}label.frequency.long"/>
        <div class="form-control-wrap">
          <div class="form-wizards-wrap">
            <div class="form-wizards-element">
              <input type="text" name="tx_scheduler[frequency]" class="form-control" id="task_frequency" value="{frequency}">
            </div>
            <f:if condition="{frequencyOptions}">
              <div class="form-wizards-items-aside">
                <div class="btn-group">
                  <select
                    class="form-control tceforms-select tceforms-wizardselect"
                    onchange="document.getElementById('task_frequency').value=this.options[this.selectedIndex].value;this.blur();this.selectedIndex=0;">
                    <option></option>
                    <f:for each="{frequencyOptions}" as="label" key="command">
                      <option value="{command}">{f:translate(key:label,default:label)} ({command})</option>
                    </f:for>
                  </select>
                </div>
              </div>
            </f:if>
          </div>
        </div>
    </div>
</div>
<div class="form-section" id="task_multiple_row">
    <div class="form-group">
        <f:be.labels.csh table="{csh}" field="task_multiple" label="{lang}label.parallel.long"/>
        <div class="form-control-wrap">
            <input type="hidden" name="tx_scheduler[multiple]" value="0">
            <input class="checkbox" type="checkbox" name="tx_scheduler[multiple]" value="1" id="task_multiple" {multiple}>
        </div>
    </div>
</div>
<div class="form-section" id="task_description_row">
    <div class="form-group">
        <f:be.labels.csh table="{csh}" field="task_description" label="{lang}label.description"/>
        <div class="form-control-wrap">
            <textarea class="form-control" name="tx_scheduler[description]">{description}</textarea>
        </div>
    </div>
</div>

<f:for each="{additionalFields}" as="field">
    <f:render section="additionalField" arguments="{field: field}" />
</f:for>

<f:format.raw>{table}</f:format.raw>


<f:render partial="ServerTime" arguments="{now: now}" />

<f:section name="additionalField">
    <div class="form-section extraFields extra_fields_{field.htmlClassName}" {field.additionalFieldsStyle} id="{field.fieldID}_row">
        <div class="form-group">
            <f:be.labels.csh table="{field.cshKey}" field="{field.cshLabel}" label="{field.langLabel}"/>
            <div class="form-control-wrap">
                {field.code -> f:format.raw()}
            </div>
            {field.browseButton -> f:format.raw()}
        </div>
    </div>
</f:section>
